﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Common.DataAnnotations
{
    /// <summary>
    /// datetime验证（yyyy-MM-dd）
    /// </summary>
    public class DateTimeAttribute : RegularExpressionAttribute
    {
        const string DateTimePattern = @"^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})( (\d{1,2}):(\d{1,2}):(\d{1,2})*)?$";
        /// <summary>
        /// datetime验证
        /// </summary>
        public DateTimeAttribute() : base(DateTimePattern)
        {
        }
    }
}
